#include"commm.hpp"

int main(){
    key_t k = getkey();
    int ret = creatmsg(k);//返回的是写的文件描述数
    cout<<"server:"<<ret<<endl;

    // char arr2[1024];
     const char arr = 'A';
    // snprintf(arr2,sizeof arr2,"开始写：%s",arr);
    //msgp:设置结构体
    struct msgbuf buffer;
    buffer.mtype = 1;
    buffer.mtext[1] = arr;
    while(true){
        msgsnd(ret,&buffer,sizeof buffer,0);
        sleep(1);
    }

    msgctl(ret,IPC_RMID,0);

    

    return 0;
}